import url from '@/tool/index.js'
export const teacherInfo = () => { //
	return new Promise(resolve => {
		uni.request({
			url: url + '/api/coachcenter.coach/profile',
			data: {
				coachtoken:uni.getStorageSync('teacherToken')
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}

export const teacherIndex = (page=1) => { //
	return new Promise(resolve => {
		uni.request({
			url: url + '/api/coachcenter.coach/index',
			data: {
				coachtoken:uni.getStorageSync('teacherToken')
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}

export const teacherStar = () => { //
	return new Promise(resolve => {
		uni.request({
			url: url + '/api/coachcenter.coach/commentList',
			data: {
				coachtoken:uni.getStorageSync('teacherToken')
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}

export const update = (info,carImg) => { //
	return new Promise(resolve => {
		uni.request({
			url: url + '/api/coachcenter.coach/profileSave',
			data: {
				coachtoken:uni.getStorageSync('teacherToken'),
				name:info.name,
				image:info.image,
				phone:info.phone,
				drive_age:info.drive_age,
				tagids:info.tagids,
				car_model:info.car_model,
				car_number:info.car_number,
				car_check:info.car_check,
				car_images:carImg,
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}
